//
//  TAMTNewsListCell.swift
//  TAMeetApp
//
//  Created by 九月 on 12/5/24.
//

import UIKit

class TAMTNewsListCell: UICollectionViewCell {

    //头像
    lazy var boaImageView = {
        let kiwano = UIImageView()
        kiwano.contentMode = .scaleAspectFill
        kiwano.clipsToBounds = true
        kiwano.image = UIImage(named: "bg")
        kiwano.layer.cornerRadius = 30;
        kiwano.layer.masksToBounds = true;
        return kiwano
    }()

    //名称
    lazy var cougarLabel = {
        let finch = UILabel()
        finch.textColor = UIColor(red: 51.0/255.0, green: 51.0/255.0, blue: 51.0/255.0, alpha: 1.0)
        finch.font = UIFont.systemFont(ofSize: 16);

        return finch
    }()

    //最后的消息内容
    lazy var hyenaLabel = {
        let sparrow = UILabel()
        sparrow.textColor = UIColor(red: 184.0/255.0, green: 187.0/255.0, blue: 190.0/255.0, alpha: 1.0)
        sparrow.numberOfLines = 2
        sparrow.font = UIFont.systemFont(ofSize: 14);

        return sparrow
    }()

    //时间
    lazy var frogLabel = {
        let apple = UILabel()
        apple.textColor = UIColor(red: 184.0/255.0, green: 187.0/255.0, blue: 190.0/255.0, alpha: 1.0)
        apple.numberOfLines = 2
        apple.font = UIFont.systemFont(ofSize: 12);

        return apple
    }()

    //标签
    lazy var armadilloImageView = {
        let pomelo = UIImageView()
        pomelo.contentMode = .scaleAspectFill
        pomelo.clipsToBounds = true

        return pomelo
    }()


    override init(frame: CGRect) {
        super.init(frame: frame)

        toTakeLayoutUI()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)

        toTakeLayoutUI()
    }

    private func toTakeLayoutUI() {

        self.contentView.addSubview(boaImageView)
        boaImageView.snp.makeConstraints { make in
            make.height.equalTo(60);
            make.width.equalTo(60);
            make.leading.equalTo(12);
            make.centerY.equalToSuperview()
        }


        self.contentView.addSubview(cougarLabel)
        cougarLabel.snp.makeConstraints { make in
            make.height.equalTo(23);
            make.top.equalTo(boaImageView).offset(4);
            make.left.equalTo(boaImageView.snp.right).offset(8.5);
        }


        self.contentView.addSubview(hyenaLabel)
        hyenaLabel.snp.makeConstraints { make in
            make.height.equalTo(20);
            make.bottom.equalTo(boaImageView).offset(-8);
            make.leading.equalTo(cougarLabel);
        }


        self.contentView.addSubview(frogLabel)
        frogLabel.snp.makeConstraints { make in
            make.height.equalTo(16);
            make.centerY.equalTo(cougarLabel);
            make.trailing.equalTo(-12);
        }

        self.contentView.addSubview(armadilloImageView)
        armadilloImageView.snp.makeConstraints { make in
            make.width.equalTo(34);
            make.height.equalTo(16);
            make.left.equalTo(cougarLabel.snp.right).offset(6);
            make.centerY.equalTo(cougarLabel)
        }

    }
}
